package org.esky;

import java.util.Arrays;

/**
 * 写一个冒泡排序的算法
 */
public class T9 {
	public static void main(String[] args) {
		int a[] = new int[] { 11, 3, 9, 4, 1, 8 };
		int temp = 0;
		for (int i = a.length -1; i >= 0; i--) {
			for (int j = 0; j < i; j++) {
				if (a[j] > a[j + 1]) {
					temp = a[j + 1];
	                a[j + 1] = a[j];
	                a[j] = temp;
				}
			}
		}
		System.out.println(Arrays.toString(a));
	}
}
